# -*- coding: utf-8 -*-
import base64
import datetime
import os
import sys
from time import sleep
import re
import requests
from PIL import Image
import json
import sys, io
from pypinyin import pinyin, lazy_pinyin, Style
from string import digits
from fake_useragent import UserAgent

sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030')
sys.setrecursionlimit(1000000)
# chrome_options 初始化选项
ua = UserAgent()

diccc = []
err = []


def main(ct):
    # ct1 = str(int(ct.strip().split(":")[2]))

    kv = {
        'user-agent': ua.random,
    }
    r = requests.get(f'http://i.meituan.com/{res}/all/?cid=1&p=1&stid_b=3&cateType=poi', headers=kv).text
    try:
        w = json.loads(re.findall('(id="filterData">)(.*)(</script>)', r)[0][1])['BizAreaList']
        #     if i['id'] in diccc:
        #         print(i['name'], i['id'])
        #         continue
        #     diccc.append(i['id'])
    except:
        print(ct)
        err.append(ct)


if __name__ == '__main__':
    with open('cityid11.txt') as fs:
        keys = fs.readlines()
    for i in keys:
        main(i)
        # input('123')
    # print(len(diccc))
    print(len(err))
    print(err)
    # print(diccc)
